package cruciverba.model;


public class ContaCaratteriNonItaliani implements IVerifica {

	@Override
	public int verify(String string) throws Exception {
		
		int occorrenzeStraniere = 0;
		int length = string.length();

		string = string.toLowerCase();
		CruciverbaUtils.isWord(string);
		
		for (int i = 0; i < length; i++) {
			switch (string.charAt(i)) {
			case 'j':
				occorrenzeStraniere++;
				break;
			case 'k':
				occorrenzeStraniere++;
				break;
			case 'w':
				occorrenzeStraniere++;
				break;
			case 'x':
				occorrenzeStraniere++;
				break;
			case 'y':
				occorrenzeStraniere++;
				break;

			default:
				break;
			}
		}

				
		return occorrenzeStraniere;
	}


	@Override
	public String modellaVerify(String string) throws Exception {
		return Integer.toString(verify(string));
	}

}
